package net.crashtoot.picasa.core.model;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.google.gdata.data.MediaContent;
import com.google.gdata.data.photos.PhotoEntry;
import com.google.gdata.util.ServiceException;

public class Photo {

    private String id;
    private String name;
    private String comment;
    private String uri;
    private Long height;
    private Long width;
    private Long size;

    public Photo() {}

    public Photo(final PhotoEntry photo) {
        id = photo.getGphotoId();
        comment = photo.getSummary().getPlainText();
        name = photo.getTitle().getPlainText();
        uri = ((MediaContent) photo.getContent()).getUri();
        try {
            height = photo.getHeight();
            width = photo.getWidth();
            size = photo.getSize();
        } catch (final ServiceException e) {}
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getComment() {
        return comment;
    }

    public String getUri() {
        return uri;
    }

    public Long getHeight() {
        return height;
    }

    public Long getWidth() {
        return width;
    }

    public Long getSize() {
        return size;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
